from langchain_community.llms import Tongyi
import os

llm = Tongyi(
    # 若没有配置环境变量，请用百炼API Key将下行替换为：api_key="sk-xxx",
    api_key=os.getenv("sk-6434b554122c4b049ceb805d703f695b"),
    model="qwen-plus",
    #base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
    base_url="http://localhost:11434/v1",
)

# 直接提供问题，并调用llm
response = llm.invoke("你是谁？")
print(response)

